using System;

namespace InvestmentIntelligence.DbModel.Models
{
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;

    [Table("TimeSerie", Schema = "MarketData")]
    public class TimeSerie
    {
        [Column(Order = 0), Key]
        public int SecurityId { get; set; }

        [Column(Order = 1), Key]
        public DateTime Date { get; set; }

        public Nullable<decimal> Open { get; set; }
        public Nullable<decimal> AdjustedOpen { get; set; }
        public Nullable<decimal> Close { get; set; }
        public Nullable<decimal> AdjustedClose { get; set; }
        public Nullable<decimal> High { get; set; }
        public Nullable<decimal> AdjustedHigh { get; set; }
        public Nullable<decimal> Low { get; set; }
        public Nullable<decimal> AdjustedLow { get; set; }
        public Nullable<decimal> StockReturn { get; set; }
        public Nullable<decimal> Bbg20DayMedianVolume { get; set; }
        public Nullable<decimal> Bbg90DayVolatility { get; set; }
        public Nullable<decimal> DayVolume { get; set; }
        public Nullable<decimal> AdjustedDayVolume { get; set; }
        public Nullable<decimal> PriceToBook { get; set; }
        public Nullable<decimal> PriceToCashflow { get; set; }
        public Nullable<decimal> PriceToEarnings { get; set; }
        public Nullable<decimal> DividendYield { get; set; }
        public Nullable<decimal> MarketCap { get; set; }
       // public virtual Security Security { get; set; }
        

        public override string ToString()
        {
            return string.Format("SecurityId: {0}, Date: {1}, Close: {2}", SecurityId, Date, Close);
        }
    }

    public class MiniTimeSerie
    {
        public int SecurityId { get; set; }
        public DateTime Date { get; set; }
        public Nullable<decimal> Close { get; set; }
    }

    public class TimeSerieAdbInfo
    {
        public DateTime Date { get; set; }
        public Nullable<decimal> Close { get; set; }
        public Nullable<decimal> StockReturn { get; set; }
        public Nullable<decimal> MarketCap { get; set; }
    }

    public struct TimeSerieAdbSearchOptions
    {
        public bool ClosePriceRequired;
        public bool StockReturnRequired;
        public bool MarketCapRequired;
    }

    public class SecurityWithDate
    {
        public int SecurityId { get; set; }
        public DateTime Date { get; set; }
    }

    public class WeightWithDate
    {
        public decimal? Weight { get; set; }
        public DateTime Date { get; set; }
        public int SecurityId { get; set; }
    }
}
